package com.amazon.dao;

import com.amazon.bo.Shop;
import com.amazon.bo.ShopGoodsBatch;
import com.amazon.bo.ShopGoodsBatchTrace;
import com.amazon.dao.base.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ShopGoodsBatchTraceDao extends BaseDao<ShopGoodsBatchTrace> {

    public ShopGoodsBatchTrace selectByBatchIdAndUploadStatus(long id, String s) {

        List<ShopGoodsBatchTrace> user= execute(session -> session
                .createNativeQuery("SELECT * FROM shop_goods_batch_trace where batch_id=:id and up_load_status=:st order by id desc limit 1 ", ShopGoodsBatchTrace.class)
                .setParameter("id", id)
                .setParameter("st", s)
                .getResultList());
        return  user.size()>0?user.get(0):null;
    }
}
